// stores/mainStore.js
import { defineStore } from 'pinia'

export const userMainStore = defineStore('main', {
  state: () => ({
    // 初始化主体对象
    mainObject: {
      id: '',
      name: '',
	  type:"",
      info: {}
    }
  }),
  getters: {
    // 快捷访问主体对象的属性（可选）
    getMainObjectName: (state) => state.mainObject.name,
    getMainObjectId: (state) => state.mainObject.id
  },
  actions: {
    // 更新主体对象
    setMainObject(data) {
      this.mainObject = { ...this.mainObject, ...data }
    },
    // 重置主体对象
    resetMainObject() {
      this.mainObject = { id: '', name: '' ,type:"", info: {} }
    }
  }
})
